//全局动画loading的状态
import { defineStore } from 'pinia'
import { ref } from 'vue'
const useLoadingStore = defineStore('loading', () => {
  const loading = ref<boolean>(true)
  //一定时间后关闭loading状态
  const changeLoadingStatus = (time: number) => {
    setTimeout(() => {
      loading.value = false
    }, time)
  }
  const closeOrOpenLoadingStatus = (status: boolean) => {
    loading.value = status
  }

  return {
    loading,
    changeLoadingStatus,
    closeOrOpenLoadingStatus,
  }
})
export default useLoadingStore
